package cn.i7baozh.consumer.consul.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author : baoqi.zhang
 * @date :   2022/4/6 18:17
 */
@RestController
@Slf4j
public class OrderController {
    @Autowired
    private RestTemplate restTemplate;

    private static final String payment_url = "http://consul-provider-payment";

    @GetMapping("/consumer/consul")
    public String getById() {
        String url = payment_url + "/payment/consul";
        log.info("url:{}",url);
        return restTemplate.getForObject(url, String.class);
    }
}
